#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        //if(nums.size() <= 1)
        //     return nums.size();
        int cur = 0, prev = 0;
        while (++cur < nums.size())
        {
            if (nums[cur] != nums[prev])
                nums[++prev] = nums[cur];
        }
        return prev + 1;
    }
};